\(\int \frac {\cot (a+i \log (x))}{x^3} \, dx\) [192]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 36 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=-\frac {i}{2 x^2}-i e^{-2 i a} \log \left (1-\frac {e^{2 i a}}{x^2}\right ) \]

[Out]

-1/2*I/x^2-I*ln(1-exp(2*I*a)/x^2)/exp(2*I*a)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {4592, 455, 45} \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=-i e^{-2 i a} \log \left (1-\frac {e^{2 i a}}{x^2}\right )-\frac {i}{2 x^2} \]

[In]

Int[Cot[a + I*Log[x]]/x^3,x]

[Out]

(-1/2*I)/x^2 - (I*Log[1 - E^((2*I)*a)/x^2])/E^((2*I)*a)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 455

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] && NeQ[b*c - a*d, 0] && EqQ[m
- n + 1, 0]

Rule 4592

Int[Cot[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*((-I - I*E^(2*I*a*d)
*x^(2*I*b*d))/(1 - E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {-i-\frac {i e^{2 i a}}{x^2}}{\left (1-\frac {e^{2 i a}}{x^2}\right ) x^3} \, dx \\ & = -\left (\frac {1}{2} \text {Subst}\left (\int \frac {-i-i e^{2 i a} x}{1-e^{2 i a} x} \, dx,x,\frac {1}{x^2}\right )\right ) \\ & = -\left (\frac {1}{2} \text {Subst}\left (\int \left (i+\frac {2 i}{-1+e^{2 i a} x}\right ) \, dx,x,\frac {1}{x^2}\right )\right ) \\ & = -\frac {i}{2 x^2}-i e^{-2 i a} \log \left (1-\frac {e^{2 i a}}{x^2}\right ) \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(136\) vs. \(2(36)=72\).

Time = 0.05 (sec) , antiderivative size = 136, normalized size of antiderivative = 3.78 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=-\frac {i}{2 x^2}-\arctan \left (\frac {\left (-1+x^2\right ) \cos (a)}{-\sin (a)-x^2 \sin (a)}\right ) \cos (2 a)+2 i \cos (2 a) \log (x)-\frac {1}{2} i \cos (2 a) \log \left (1+x^4-2 x^2 \cos (2 a)\right )+i \arctan \left (\frac {\left (-1+x^2\right ) \cos (a)}{-\sin (a)-x^2 \sin (a)}\right ) \sin (2 a)+2 \log (x) \sin (2 a)-\frac {1}{2} \log \left (1+x^4-2 x^2 \cos (2 a)\right ) \sin (2 a) \]

[In]

Integrate[Cot[a + I*Log[x]]/x^3,x]

[Out]

(-1/2*I)/x^2 - ArcTan[((-1 + x^2)*Cos[a])/(-Sin[a] - x^2*Sin[a])]*Cos[2*a] + (2*I)*Cos[2*a]*Log[x] - (I/2)*Cos
[2*a]*Log[1 + x^4 - 2*x^2*Cos[2*a]] + I*ArcTan[((-1 + x^2)*Cos[a])/(-Sin[a] - x^2*Sin[a])]*Sin[2*a] + 2*Log[x]
*Sin[2*a] - (Log[1 + x^4 - 2*x^2*Cos[2*a]]*Sin[2*a])/2

Maple [A] (verified)

Time = 0.21 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.06

method result size
risch \(-\frac {i}{2 x^{2}}-i {\mathrm e}^{-2 i a} \ln \left ({\mathrm e}^{2 i a}-x^{2}\right )+2 i {\mathrm e}^{-2 i a} \ln \left (x \right )\) \(38\)

[In]

int(cot(a+I*ln(x))/x^3,x,method=_RETURNVERBOSE)

[Out]

-1/2*I/x^2-I*exp(-2*I*a)*ln(exp(2*I*a)-x^2)+2*I*exp(-2*I*a)*ln(x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.08 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=\frac {{\left (-2 i \, x^{2} \log \left (x^{2} - e^{\left (2 i \, a\right )}\right ) + 4 i \, x^{2} \log \left (x\right ) - i \, e^{\left (2 i \, a\right )}\right )} e^{\left (-2 i \, a\right )}}{2 \, x^{2}} \]

[In]

integrate(cot(a+I*log(x))/x^3,x, algorithm="fricas")

[Out]

1/2*(-2*I*x^2*log(x^2 - e^(2*I*a)) + 4*I*x^2*log(x) - I*e^(2*I*a))*e^(-2*I*a)/x^2

Sympy [A] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.08 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=2 i e^{- 2 i a} \log {\left (x \right )} - i e^{- 2 i a} \log {\left (x^{2} - e^{2 i a} \right )} - \frac {i}{2 x^{2}} \]

[In]

integrate(cot(a+I*ln(x))/x**3,x)

[Out]

2*I*exp(-2*I*a)*log(x) - I*exp(-2*I*a)*log(x**2 - exp(2*I*a)) - I/(2*x**2)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 135 vs. \(2 (24) = 48\).

Time = 0.21 (sec) , antiderivative size = 135, normalized size of antiderivative = 3.75 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=-\frac {x^{2} {\left (i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \log \left (x^{2} + 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) + x^{2} {\left (i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \log \left (x^{2} - 2 \, x \cos \left (a\right ) + \cos \left (a\right )^{2} + \sin \left (a\right )^{2}\right ) - 2 \, {\left ({\left (\cos \left (2 \, a\right ) - i \, \sin \left (2 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x + \cos \left (a\right )\right ) - {\left (\cos \left (2 \, a\right ) - i \, \sin \left (2 \, a\right )\right )} \arctan \left (\sin \left (a\right ), x - \cos \left (a\right )\right ) + 2 \, {\left (i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \log \left (x\right )\right )} x^{2} + i}{2 \, x^{2}} \]

[In]

integrate(cot(a+I*log(x))/x^3,x, algorithm="maxima")

[Out]

-1/2*(x^2*(I*cos(2*a) + sin(2*a))*log(x^2 + 2*x*cos(a) + cos(a)^2 + sin(a)^2) + x^2*(I*cos(2*a) + sin(2*a))*lo
g(x^2 - 2*x*cos(a) + cos(a)^2 + sin(a)^2) - 2*((cos(2*a) - I*sin(2*a))*arctan2(sin(a), x + cos(a)) - (cos(2*a)
 - I*sin(2*a))*arctan2(sin(a), x - cos(a)) + 2*(I*cos(2*a) + sin(2*a))*log(x))*x^2 + I)/x^2

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 49 vs. \(2 (24) = 48\).

Time = 0.27 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.36 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx=\frac {1}{2} \, \pi e^{\left (-2 i \, a\right )} - i \, e^{\left (-2 i \, a\right )} \log \left (x + e^{\left (i \, a\right )}\right ) + 2 i \, e^{\left (-2 i \, a\right )} \log \left (x\right ) - i \, e^{\left (-2 i \, a\right )} \log \left (-x + e^{\left (i \, a\right )}\right ) - \frac {i}{2 \, x^{2}} \]

[In]

integrate(cot(a+I*log(x))/x^3,x, algorithm="giac")

[Out]

1/2*pi*e^(-2*I*a) - I*e^(-2*I*a)*log(x + e^(I*a)) + 2*I*e^(-2*I*a)*log(x) - I*e^(-2*I*a)*log(-x + e^(I*a)) - 1
/2*I/x^2

Mupad [B] (verification not implemented)

Time = 27.46 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.03 \[ \int \frac {\cot (a+i \log (x))}{x^3} \, dx={\mathrm {e}}^{-a\,2{}\mathrm {i}}\,\ln \left (x\right )\,2{}\mathrm {i}-\ln \left (x^2-{\mathrm {e}}^{a\,2{}\mathrm {i}}\right )\,{\mathrm {e}}^{-a\,2{}\mathrm {i}}\,1{}\mathrm {i}-\frac {1{}\mathrm {i}}{2\,x^2} \]

[In]

int(cot(a + log(x)*1i)/x^3,x)

[Out]

exp(-a*2i)*log(x)*2i - log(x^2 - exp(a*2i))*exp(-a*2i)*1i - 1i/(2*x^2)